package com.itheima.demo09;

import java.io.*;
import java.net.Socket;

public class ClientDemo03 {
    public static void main(String[] args) throws IOException {
        Socket s = new Socket("127.0.0.1",10014);
        BufferedInputStream bis = new BufferedInputStream(new FileInputStream("day16\\copy.jpg"));

        BufferedOutputStream bos = new BufferedOutputStream(s.getOutputStream());
        int b;
        while ((b = bis.read()) != -1){
            bos.write(b);
        }
        bos.flush();
        s.shutdownOutput();

        BufferedReader br = new BufferedReader(new InputStreamReader(s.getInputStream()));
        String line;
        while ((line = br.readLine()) != null) {
            System.out.println(line);
        }
        br.close();
        s.close();
        bis.close();
        bos.close();
    }
}
